
<script type="text/javascript">
function sendInput(input,newsender) {
	window.opener.document.getElementById(input).value = newsender;
	window.close();  //ถ้าจะส่งค่าแล้วให้ปิดหน้าต่างก็เอา comment ออก
}
</script>
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>

<table width='600' border='1' cellpadding='0' cellspacing='0' bordercolor='#CCCCCC'>
  <tr bgcolor="#666666">
    <td width='35'><div align='center' class="style1"><small>ลำดับ </small></div></td>
  	<td width='163'><div align='center' class="style1"><small>ชื่อ - นามสกุล</small></div></td>
    <td width='135'> <div align='center' class="style1"><small>อีเมลล์</small></div></td>
    <td width='86'> <div align='center' class="style1"><small>จังหวัด</small></div></td>
    <td width='73'> <div align='center' class="style1"><small>office</small></div></td>
    <td width='94'> <div align='center' class="style1"><small>โทรศัพท์ </small></div></td>
  </tr>

<?php
include('../config.inc.php');
echo "<meta http-equiv='content-type' content='text/html; charset=$charset'>"; 
//echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$charset\">";
$input = $_GET[input];
$result = mysql_query("select * from users where flag = 2");
$num = mysql_num_rows($result);
$n = 1;
while($arr = mysql_fetch_array($result)){
	//echo "<a href=\"javascript:sendInput('".$input."','".$arr[username]."');\">".$arr['name']."</a>------".$arr['username']."@ttt.co.th<br>";
	if($n%2==0){
		$bg = '#E8E8E8';
	}else{
		$bg = '#FFFFFF';
	}
	echo "<tr bgcolor='$bg'>
    <td width='35'><div ><small>$n&nbsp;</small></div></td>
  	<td width='163'><div ><small><a href=\"javascript:sendInput('$input','$arr[username]');\">$arr[name]</a>&nbsp;</small></div></td>
    <td width='135'> <div ><small>$arr[username]@ttt.co.th&nbsp;</small></div></td>
    <td width='86'> <div ><small>$arr[pnthai]&nbsp;</small></div></td>
    <td width='73'> <div ><small>$arr[office]&nbsp;</small></div></td>
    <td width='94'> <div ><small>$arr[tel]&nbsp;</small></div></td>
  	</tr>";
	$n++;
}
mysql_close($connect);
?>
</table>
